<!DOCTYPE html>
<html>
<head>
  <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  <title>flv.js demo</title>
  <style>
    .mainContainer {
      display: block;
      width: 1024px;
      margin-left: auto;
      margin-right: auto;
    }
    .urlInput {
      display: block;
      width: 100%;
      margin-left: auto;
      margin-right: auto;
      margin-top: 8px;
      margin-bottom: 8px;
    }
    .centeredVideo {
      display: block;
      width: 100%;
      height: 576px;
      margin-left: auto;
      margin-right: auto;
      margin-bottom: auto;
    }
    .controls {
      display: block;
      width: 100%;
      text-align: left;
      margin-left: auto;
      margin-right: auto;
    }
  </style>
</head>
<body>
<div class="mainContainer">
  <video id="videoElement" class="centeredVideo" muted controls autoplay width="1024" height="576">Your browser is too old which doesn't support HTML5 video.</video>
</div>
<br>
<div class="controls">
  <!--<button onclick="flv_load()">加载</button>-->
  <button onclick="flv_start()">开始</button>
  <button onclick="flv_pause()">暂停</button>
  <button onclick="flv_destroy()">停止</button>
  <input style="width:100px" type="text" name="seekpoint" />
  <button onclick="flv_seekto()">跳转</button>
</div>
<script src="https://cdn.bootcss.com/flv.js/1.5.0/flv.js"></script>
<script>
    var player = document.getElementById('videoElement');
    if (flvjs.isSupported()) {
        flvPlayer = flvjs.createPlayer({
            isLive: true,
            type: 'flv',
            url: 'http://192.1.8.105:10800/flv/hls/stream_3.flv',
            // url:'https://hw.flv.huya.com/huyalive/79572477-79572477-341761186376712192-2879801444-10057-A-0-1.flv?wsSecret=eec1cdea3a93df8e2df671ea48131b0a&wsTime=5e169391&fs=bgct&u=126147107090&t=100&sv=1911131147'
        });
        flvPlayer.attachMediaElement(player);
        flvPlayer.load(); //加载
    }
    function flv_start() {
        console.log('load')
        player.play();
    }

    function flv_pause() {
        player.pause();
    }

    function flv_destroy() {
        player.pause();
        player.unload();
        player.detachMediaElement();
        player.destroy();
        player = null;
    }

    function flv_seekto() {
        player.currentTime = parseFloat(document.getElementsByName('seekpoint')[0].value);
    }
</script>
</body>
</html>